import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;


public class Parser {
		
	Queue<String> my_queue;
	
	
	public Parser(){
		
		my_queue = new Queue<String>();
	}
	
	public void parseAnchorTags() {
		
		String htmlContent = my_queue.dequeue();
		List<String> a_tag_list = new ArrayList<String>();
		char[] content_char = htmlContent.toCharArray();

		boolean a_tag = false;

		int a_tag_ind = 0;

		int a_tag_end = 0;

		for (int i = 0; i < content_char.length; i++) {

			if (content_char[i] == '<' && content_char[i+1] == 'a') {

				a_tag = true;

				a_tag_ind = i;

				continue;

			}

			if (a_tag && content_char[i] == '>') {

				a_tag_end = i;

				a_tag = false;

				a_tag_list.add(htmlContent.substring(a_tag_ind, a_tag_end));

			}

		}

		//htmlContent.substring(beginIndex, endIndex);

	}

	public URL parseAnchorTag(String aTagContent) throws MalformedURLException {
	
		StringBuffer href = new StringBuffer();
		
		URL href_url = new URL(href.toString());
		
		return href_url;

	}
	
	public void add(String the_url) {
		
		my_queue.enqueue(the_url);
	}
}
